package tests

import (
	"context"
	"fmt"
	"testing"

	"fiberx/internal/global"
)

func TestRedis(t *testing.T) {
	ctx := context.Background()
	// 创建redis客户端
	RedisClient := global.R
	err := RedisClient.Set(ctx, "key", "value", 10).Err()
	if err != nil {
		fmt.Printf("Failed to set key: %v\n", err)
		return
	}

	val, err := RedisClient.Get(ctx, "key").Result()
	if err != nil {
		fmt.Printf("Failed to get key: %v\n", err)
		return
	}
	fmt.Println("Value:", val)
}
